package com.aifund.common.entity;

import lombok.Data;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.Where;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 用户提币
 */
@Entity
@SQLDelete(sql = "update user_cash set delete = 1 where id = ?")
@Where(clause = "is_del = 0")
@Data
@EntityListeners(AuditingEntityListener.class)
public class UserCash {

    @Id
    @GeneratedValue
    private Long id;
    //用户Id
    private Long userId;
    //用户提币币种类型ID
    private Long systemCoinAccountId;
    //提币数量
    private BigDecimal cashNum;
    //提币手续费
    private BigDecimal cashHandlingFee;
    //到账数量
    private BigDecimal arrivalQuantity;
    //提币状态
    private Integer status;
    //用户提币地址
    private String cashUrl;

    @CreatedDate
    @Column(name = "createTime",updatable = false,nullable = false)
    private Date createTime;

    @LastModifiedDate
    @Column(name = "updateTime",nullable = false)
    private Date updateTime;

    @Type(type = "org.hibernate.type.NumericBooleanType")
    private Boolean isDel = false;

}
